import React from "react";

// 函数组件通过props参数进行接受
const List = ({ list, onRemove }) => {
  return (
    <ul>
      {list.map((item) => (
        <li key={item.id}>
          {item.name} - <button onClick={onRemove(item.id)}>删除</button>
        </li>
      ))}
    </ul>
  );
};

export default List;
